//    Copyright (C) Kherty.  All rights reserved.
using System;

namespace OpenLS.Spreadsheet.Extensibility
{
    public class AllowCellToRangeConversionAttribute : Attribute, IParameterConverter, IParameterConverterProvider
    {
        #region IArgumentConverter Members

        public void Convert(ConversionData data)
        {
            if (typeof(IRange).IsAssignableFrom(data.TargetType) && data.Value is ICell)
            {
                data.Result = ((ICell) data.Value).ToRange();
            }
        }

        public int Priority
        {
            get { return 10; }
        }

        #endregion

        #region IArgumentConverterProvider Members

        public IParameterConverter GetConverter()
        {
            return this;
        }

        #endregion
    }
}